package com.io;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * The class/interface
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
@SpringBootApplication
@Slf4j
public class JarRun implements CommandLineRunner {
    public boolean flag = true;

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(JarRun.class);
        springApplication.setWebApplicationType(WebApplicationType.NONE);
        SpringApplication.run(JarRun.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        // 这里也可以添加一些业务处理方法，比如一些初始化参数等
        while (flag) {
            try {
                log.info(JarRun.class.getName() + "监听应用已经启动...");
                Thread.sleep(Long.MAX_VALUE);
            } catch (Exception e) {
                flag = false;
            }
        }
    }
}
